package se.talento.restlet;

import org.restlet.data.MediaType;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import java.util.logging.Logger;

public class DefaultResource extends ServerResource {
	private static final Logger log = Logger.getLogger(DefaultResource.class.getName());	
	String greeting = "GREETINGS DR FALKEN. WOULD YOU LIKE TO PLAY A GAME?\n\n\n" +
	"Test resoures:\n\n" +
	"/test.html\n\n\n" +
	"Resources:\n\n" +
	"GET /version\n" +
	"The current version of this application.\n\n" +
	"POST /items?name=item1&description=description1\n" +
	"Registers an item. Returns 201 Created with text 'Item Created' or returns an XML document with error message 'Item item1 already exists' if that is the case.\n\n" +
	"GET /items?name=item1\n" +
	"Fetches an item by name. Returns 200 OK with an XML document with the requested item.\n\n" +
	"GET /items\n" +
	"Lists all items. Returns 200 OK with an XML document with a list of registered items.\n\n" +
	"PUT /items?name=item1&description=description1_changed\n" +
	"Updates item with name item1. Returns 200 OK if successful.\n\n" +
	"DELETE /items?name=item1\n" +
	"Deletes item with name item1. Returns 204 No Content if successful.";
	
    @Get("txt")
    public Representation toTxt() {
    	log.finest("Accessed");
        StringRepresentation representation = new StringRepresentation(greeting, MediaType.TEXT_PLAIN);
        return representation;
    }
}